<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateApplySamples extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('apply_samples',['id'=>false,'comment'=>'申请领样表','collation'=>'utf8mb4_general_ci']);

        $table->addColumn('id', 'biginteger', ['limit' => 20, 'identity' => true, 'signed' => false])
            ->setPrimaryKey('id')
            ->addColumn('user_id','biginteger',['limit'=>20,'comment'=>'申请用户id'])
            ->addColumn('sw_user_id','biginteger',['limit'=>20,'comment'=>'商务用户id'])
            ->addColumn('dy_uid','string',['limit'=>32,'default'=>'0','comment'=>'抖音uid'])
            ->addColumn('activity_goods_id','string',['limit'=>500,'comment'=>'商品id串'])
           //->addColumn('samples_no','string',['limit'=>60,'comment'=>'申请唯一编号'])
            ->addColumn('remark','string',['limit'=>120,'default'=>'','comment'=>'备注'])
            ->addColumn('contact_name','string',['limit'=>100,'comment'=>'联系人姓名'])
            ->addColumn('contact_phone','string',['limit'=>11,'comment'=>'联系人手机号'])
            ->addColumn('address','string',['limit'=>500,'comment'=>'完整收货地址'])
            ->addColumn('express_no','string',['limit'=>50,'default'=>'','comment'=>'快递单号'])
            ->addColumn('express_name','string',['limit'=>50,'default'=>'','comment'=>'物流名称'])
            ->addColumn('status','boolean',['limit'=>1,'default'=>0,'comment'=>'状态  0为待发样，1为已发样 2已取消'])
            ->addColumn('create_time','datetime',['comment'=>'创建时间'])
            ->addColumn('update_time','datetime',['comment'=>'更新时间'])
            ->create();
    }
}
